﻿<html>

<head>

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

    <title></title>


</head>


<body>
    <ul id="test">
        <li>1</li>
        <li>2</li>
        <li>3</li>
    </ul>

    <script>
        var ul = document.getElementById("test");

        for (let i in ul.children) {
            if (ul.children[i].nodeName == 'LI') {
                ul.children[i].addEventListener("click", function (a, b, c) {
                    alert(i);
                });
            }
        }


        var arr = [{
            id: 1,
            children: [''] | null
        }, {
            id: 2,
            children: [''] | null
        }, {
            id: 3,
            children: [''] | null
        }];

        var list = [];
        arr.forEach(function (item) {
            list.push(item.id);
        });
        console.log(list);

        //var tag = 0;

        function test1() {
            return tag;
        }
        function test2(tag) {
            tag = 1
            return tag;
        }
        function test3() {
            return (test2());
        }

        console.log(test3());
        console.log(test2());
        console.log(test1());
    </script>

</body>
</html>